export const localStorage = {
  get(key: string) {
    return uni.getStorageSync(key);
  },
  set(key: string, value: any) {
    uni.setStorageSync(key, value);
  },
  update(key: string, value: any) {
    let oldVal = this.get(key);
    if (oldVal !== null && typeof oldVal == "object") {
      value = Object.assign({}, oldVal, value);
    }
    this.set(key, value);
  },
  remove(key: string) {
    uni.removeStorageSync(key);
  },
};

export default localStorage;
